package com.sxt.springsecuritytest2.mapper;

import com.sxt.springsecuritytest2.bean.SysRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/*
 *
 * @Description todo
 * @author qqg
 * @date $date$
 * @param $params$
 * @return $return$
 **/
@Mapper
public interface SysRoleMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(SysRole record);

    int insertSelective(SysRole record);

    SysRole selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(SysRole record);

    int updateByPrimaryKey(SysRole record);

//    @Select("SELECT r.id, r.role_name roleName, r.role_desc roleDesc "
//            + "FROM sys_role r, sys_user_role ur "
//            + "WHERE r.id=ur.rid AND ur.uid=#{id}")
    @Select("select r.id as id,r.ROLE_NAME as roleName,r.ROLE_DESC as roleDesc " +
            "from sys_role r,sys_user_role ur " +
            "where r.id = ur.rid and ur.uid = #{id}")
    List<SysRole> findByUid(Integer id);
}